


from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from rest_framework.schemas import get_schema_view
from rest_framework.documentation import include_docs_urls
from books.api_views import (
    AuthorViewSet, PublisherViewSet, BookViewSet,
    BookLoanViewSet, BookReviewViewSet, BulkUpdatePricesView
)

router = routers.DefaultRouter()
router.register(r'authors', AuthorViewSet)
router.register(r'publishers', PublisherViewSet)
router.register(r'books', BookViewSet)
router.register(r'loans', BookLoanViewSet)
router.register(r'reviews', BookReviewViewSet)

schema_view = get_schema_view(title='Book Manager API')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path('api/bulk-update-prices/', BulkUpdatePricesView.as_view()),
    path('api/schema/', schema_view),
    path('api/docs/', include_docs_urls(title='Book Manager API')),
    path('api/auth/', include('rest_framework.urls')),
]